From e63aa7c25bcad93030b276c5fce6df175f4c4dd6 Mon Sep 17 00:00:00 2001 From: Keir Fraser Date: Sat, 5 Mar 2011 16:02:33 +0000 Subject: [PATCH] x86: Cache read of cpu_state in __cpu_die() for subsequent BUG_ON check. Otherwise compiler may re-read cpu_state for the BUG_ON and see a modified value causing erroneous BUG. Signed-off-by: Keir Fraser Signed-off-by: Liu, Jinsong --- xen/arch/x86/smpboot.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/xen/arch/x86/smpboot.c b/xen/arch/x86/smpboot.c index 7c14f06286..39eb583e84 100644 --- a/xen/arch/x86/smpboot.c +++ b/xen/arch/x86/smpboot.c @@ -861,10 +861,11 @@ void __cpu_die(unsigned int cpu) { /* We don't do anything here: idle task is faking death itself. */ unsigned int i = 0; + enum cpu_state seen_state; - while ( cpu_state != CPU_STATE_DEAD ) + while ( (seen_state = cpu_state) != CPU_STATE_DEAD ) { - BUG_ON(cpu_state != CPU_STATE_DYING); + BUG_ON(seen_state != CPU_STATE_DYING); mdelay(100); cpu_relax(); process_pending_softirqs(); -- 2.30.2